OSVSize As Long 'size, in bytes, of this data structure
dwVerMajor As Long 'ie NT 3.51, dwVerMajor = 3; NT 4.0, dwVerMajor = 4.
dwVerMinor As Long 'ie NT 3.51, dwVerMinor = 51; NT 4.0, dwVerMinor= 0.
dwBuildNumber As Long 'NT: build number of the OS
'Win9x: build number of the OS in low-order word.
' High-order word contains major & minor ver nos.
PlatformID As Long 'Identifies the operating system platform.
szCSDVersion As String * 128 'NT: string, such as "Service Pack 3"
'Win9x: 'arbitrary additional information'
End Type
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
'Private Const INVALID_HANDLE_VALUE = -1
Private Const MAX_PATH = 260
'Private Type FILETIME
' dwLowDateTime As Long
' dwHighDateTime As Long
'End Type
'Private Type WIN32_FIND_DATA
' dwFileAttributes As Long
' ftCreationTime As FILETIME
' ftLastAccessTime As FILETIME
' ftLastWriteTime As FILETIME
' nFileSizeHigh As Long
' nFileSizeLow As Long
' dwReserved0 As Long
' dwReserved1 As Long
' cFileName As String * MAX_PATH
' cAlternate As String * 14
'End Type
'find file API functions
Private Declare Function SearchTreeForFile Lib "imagehlp.dll" (ByVal sRootPath As String, ByVal InputPathName As String, ByVal OutputPathBuffer As String) As Boolean
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
'enumerate drives API functions
Private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Const DRIVE_REMOVABLE = 2
Private Const DRIVE_FIXED = 3
Private Const DRIVE_REMOTE = 4
Private Const DRIVE_CDROM = 5
Private Const DRIVE_RAMDISK = 6
Private Function GetWinDir() As String
Dim nSize As Long
Dim tmp As String
tmp = Space$(256)
nSize = Len(tmp)
Call GetWindowsDirectory(tmp, nSize)
GetWinDir = Trim(tmp)
End Function
Private Function IsWin95() As Boolean
Dim OSV As OSVERSIONINFO
OSV.OSVSize = Len(OSV)
If GetVersionEx(OSV) = 1 Then 'PlatformId contains a value representing the OS.
IsWin95 = (OSV.PlatformID = VER_PLATFORM_WIN32_WINDOWS) And _
(OSV.dwVerMajor = 4 And OSV.dwVerMinor = 0)
End If
End Function
Private Function IsWin98() As Boolean
Dim OSV As OSVERSIONINFO
OSV.OSVSize = Len(OSV)
If GetVersionEx(OSV) = 1 Then 'PlatformId contains a value representing the OS.
IsWin98 = (OSV.PlatformID = VER_PLATFORM_WIN32_WINDOWS) And _
(OSV.dwVerMajor > 4) Or _
(OSV.dwVerMajor = 4 And OSV.dwVerMinor > 0)
End If
End Function
Private Function IsWinNT() As Boolean
Dim OSV As OSVERSIONINFO
OSV.OSVSize = Len(OSV)
If GetVersionEx(OSV) = 1 Then 'PlatformId contains a value representing the OS.